import BirdCtrl from "./BirdCtrl";

export default class AutoMove extends Laya.Script {

    constructor() { 
        super(); 
        /** @prop {name:moveSpeed, tips:"整数类型示例", type:Number, default:null}*/
        let moveSpeed=null;
        this.bird=null;
        // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    }
    onAwake(){
        this.owner.getComponent(Laya.RigidBody).linearVelocity={x:-this.moveSpeed,y:0}
        Laya.stage.on("Again",this,function(){ 
            this.owner.getComponent(Laya.RigidBody).linearVelocity={x:-this.moveSpeed,y:0}
        })
    }
    onUpdate(){
        if(BirdCtrl.getGameover()){
            this.owner.getComponent(Laya.RigidBody).linearVelocity={x:0,y:0}
        }
    }
}